﻿using ConsoleApplication5.官方列子简化版;
using System;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            //网址：https://www.cnblogs.com/zhili/p/BuilderPattern.html
            //建造者模式的意义在于拆分

            Console.WriteLine("------------------------------------1-----------------------------");
            // 客户找到电脑城老板说要买电脑，这里要装两台电脑
            // 创建指挥者和构造者
            Director director = new Director();

            //Builder b1 = new ConcreteBuilder1();
            //Builder b2 = new ConcreteBuilder2();

            //director.Construct(b1); // 老板叫员工去组装第一台电脑
            //b1.GetComputer().Show();// 组装完，组装人员搬来组装好的电脑

            //director.Construct(b2); // 老板叫员工去组装第二台电脑
            //b2.GetComputer().Show();


            director.Construct1(new ConcreteBuilder1()).GetComputer().Show();
            director.Construct1(new ConcreteBuilder2()).GetComputer().Show();
            Console.WriteLine();

            //director.Construct2(new ConcreteBuilder1()).Show();
            //director.Construct2(new ConcreteBuilder2()).Show();
            //Console.WriteLine();

            Console.WriteLine("------------------------------------2-----------------------------");
            AbstractBuilder abstractBuilder = new Builder1();
            ConsoleApplication5.官方列子简化版.Product product2 = abstractBuilder.GetProduct();
            product2.Print();
        }
    }
}
